﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Portfolio.BL.Dictionary
{
    /// <summary>
    /// Wspólna klasa dla słowników, wzorzec singleton
    /// </summary>
    public sealed class CommonDictionary
    {
        private static CommonDictionary _instance;       
        private Dictionary<int, string> _statusDictionary;
        private Dictionary<int, string> _activeDictionary;
        private Dictionary<int, string> _pageSizeDictionary;        

        /// <summary>
        /// Prywatny konstruktor
        /// </summary>
        private CommonDictionary()
        {   
            if (_activeDictionary == null)
            {
                _activeDictionary = new Dictionary<int, string>();
                _activeDictionary.Add(0, "Ukryte");
                _activeDictionary.Add(1, "Widoczne");
            }

            if (_statusDictionary == null)
            {
                _statusDictionary = new Dictionary<int, string>();
                _statusDictionary.Add(0, "Nieopublikowane");
                _statusDictionary.Add(1, "Opublikowane");
                _statusDictionary.Add(2, "Archiwalne");
            }

            if (_pageSizeDictionary == null)
            {
                _pageSizeDictionary = new Dictionary<int, string>();
                _pageSizeDictionary.Add(0, "10");
                _pageSizeDictionary.Add(1, "15");
                _pageSizeDictionary.Add(2, "20");
            }
        }

        /// <summary>
        /// Jedna instancja w całej aplikacji
        /// </summary>
        public static CommonDictionary Instance
        {
            get
            {
                return _instance ?? (_instance = new CommonDictionary());
            }
        }        

        /// <summary>
        /// Słownik Active
        /// </summary>
        /// <returns>Active</returns>
        public Dictionary<int, string> GetActiveDictionary()
        {
            return _activeDictionary;
        }

        /// <summary>
        /// Słownik Status
        /// </summary>
        /// <returns>Status</returns>
        public Dictionary<int, string> GetStatusDictionary()
        {
            return _statusDictionary;
        }

        /// <summary>
        /// Słownik PageSize
        /// </summary>
        /// <returns>PageSize</returns>
        public Dictionary<int, string> GetPageSizeDictionary()
        {
            return _pageSizeDictionary;
        }        
    }
}
